package com.woniuxy.servicelayer.util;

import org.apache.commons.codec.binary.Base64;

import java.nio.charset.StandardCharsets;

public class Base64Util {

    //base64加密
    public static String base64Encode(String oriString){
        String encodeBase64String = Base64.encodeBase64String(oriString.getBytes(StandardCharsets.UTF_8));
        return encodeBase64String;

    }

    //base64解密
    public static String base64Decode(String encodeBase64String){
        byte[] bytes = Base64.decodeBase64(encodeBase64String.getBytes(StandardCharsets.UTF_8));
        String decodeBase64 = new String(bytes);
        return decodeBase64;
    }

}
